﻿<UserControl x:Class="CPPEI.Coolzon.BrowserApp.MainViewControl.SceneImmediate"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"              
             xmlns:local="clr-namespace:CPPEI.Coolzon.BrowserApp.MainViewControl"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="200"
              xmlns:Ext="clr-namespace:CPPEI.Coolzon.Metadata;assembly=CPPEI.Coolzon.MEtadata" 
              xmlns:ExtConvert="clr-namespace:CPPEI.Coolzon.UI;assembly=CPPEI.Coolzon.UI">
    <DockPanel x:Name="dpLayout">
        <DockPanel.Resources>
            <ExtConvert:True2VisibleConverter  x:Key="true2VisibleConverter"/>
            
            <Style TargetType="TreeViewItem">
                <Style.Triggers>
                    <Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="True">
                        <Setter Property="ItemsControl.ItemsPanel">
                            <Setter.Value>
                                <ItemsPanelTemplate>
                                    <VirtualizingStackPanel IsItemsHost="True" />
                                </ItemsPanelTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
                <Style.Resources>
                    <ResourceDictionary />
                </Style.Resources>
                <Setter Property="Panel.Background" Value="#00FFFFFF"/>
                <Setter Property="Control.HorizontalContentAlignment">
                    <Setter.Value>
                        <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
                    </Setter.Value>
                </Setter>
                <Setter Property="Control.VerticalContentAlignment">
                    <Setter.Value>
                        <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
                    </Setter.Value>
                </Setter>
                <Setter Property="Control.Padding" Value="0,0,0,0"/>
                
                <Setter Property="TextElement.Foreground">
                    <Setter.Value>
                        <DynamicResource ResourceKey="{x:Static SystemColors.ControlTextBrushKey}" />
                    </Setter.Value>
                </Setter>
                <Setter Property="TreeViewItem.Cursor" Value="Hand"></Setter>
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="TreeViewItem">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Border BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="{TemplateBinding Control.Padding}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" Name="Bd" SnapsToDevicePixels="True" Grid.Column="1">
                                    <ContentPresenter Content="{TemplateBinding HeaderedContentControl.Header}" ContentTemplate="{TemplateBinding HeaderedContentControl.HeaderTemplate}" ContentStringFormat="{TemplateBinding HeaderedItemsControl.HeaderStringFormat}" ContentSource="Header" Name="PART_Header" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                                </Border>
                                <!-- 承载子节点的容器 -->
                                <ItemsPresenter Name="ItemsHost" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" Margin="10,0,0,0" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="TreeViewItem.IsExpanded" Value="False">
                                    <Setter Property="UIElement.Visibility" TargetName="ItemsHost">
                                        <Setter.Value>
                                            <x:Static Member="Visibility.Collapsed" />
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                                <Trigger Property="TreeViewItem.IsSelected" Value="True">
                                    <Setter Property="Panel.Background" TargetName="Bd">
                                        <Setter.Value>
                                            <DynamicResource ResourceKey="{x:Static SystemColors.HighlightBrushKey}" />
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="TextElement.Foreground">
                                        <Setter.Value>
                                            <DynamicResource ResourceKey="{x:Static SystemColors.HighlightTextBrushKey}" />
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="TreeViewItem.IsSelected" Value="True">
                                        </Condition>
                                        <Condition Property="Selector.IsSelectionActive" Value="False">
                                        </Condition>
                                    </MultiTrigger.Conditions>
                                    <Setter Property="Panel.Background" TargetName="Bd">
                                        <Setter.Value>
                                            <DynamicResource ResourceKey="{x:Static SystemColors.ControlBrushKey}" />
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="TextElement.Foreground">
                                        <Setter.Value>
                                            <DynamicResource ResourceKey="{x:Static SystemColors.ControlTextBrushKey}" />
                                        </Setter.Value>
                                    </Setter>
                                </MultiTrigger>
                                <Trigger Property="UIElement.IsEnabled" Value="False">
                                    <Setter Property="TextElement.Foreground">
                                        <Setter.Value>
                                            <DynamicResource ResourceKey="{x:Static SystemColors.GrayTextBrushKey}" />
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </DockPanel.Resources>
            <TextBlock x:Name="tbCurrentDate" Height="40" HorizontalAlignment="Stretch" TextAlignment="Center" Padding="0,11" Foreground="White" DockPanel.Dock="Top">
                <TextBlock.Background>
                    <ImageBrush ImageSource="/CPPEI.Coolzon.BrowserApp;component/Images/zct.png"/>
                </TextBlock.Background>
            </TextBlock>
        <TreeView x:Name="tvList" ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectedItemChanged="tvList_SelectedItemChanged" >

                <TreeView.Background>
                    <ImageBrush ImageSource="/CPPEI.Coolzon.BrowserApp;component/Images/left-bg.jpg"/>
                </TreeView.Background>
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate DataType="{x:Type Ext:Scene}" ItemsSource="{Binding Path=Scenes}">
                    <StackPanel Orientation="Horizontal" Width="200" Height="32" Visibility="{Binding Path=IsShowInNavigation, Converter={StaticResource true2VisibleConverter}}">
                        <StackPanel.Resources>
                            <Storyboard x:Key="OnMouseEnter1">
                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(StackPanel.Background)">
                                    <DiscreteObjectKeyFrame KeyTime="00:00:00" >
                                        <DiscreteObjectKeyFrame.Value>
                                            <ImageBrush ImageSource="/CPPEI.Coolzon.BrowserApp;component/Images/zct.png"/>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="OnMouseLeave1">
                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(StackPanel.Background)">
                                    <DiscreteObjectKeyFrame KeyTime="00:00:00" >
                                        <DiscreteObjectKeyFrame.Value>
                                            <ImageBrush ImageSource="/CPPEI.Coolzon.BrowserApp;component/Images/an.jpg"/>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </StackPanel.Resources>
                        
                        <StackPanel.Background>
                            <ImageBrush ImageSource="/CPPEI.Coolzon.BrowserApp;component/Images/an.jpg"/>
                        </StackPanel.Background>
                        <Image Source="/CPPEI.Coolzon.BrowserApp;component/Images/leftbg.jpg" Width="8"/>
                        <TextBlock VerticalAlignment="Center" TextAlignment="Center" Text="{Binding Path=Caption}" TextWrapping="Wrap" MaxWidth="161"></TextBlock>
                        
                        <StackPanel.ToolTip>
                            <TextBlock VerticalAlignment="Center" Text="{Binding Path=Caption}" TextWrapping="Wrap" MaxWidth="200" ></TextBlock>
                        </StackPanel.ToolTip>
                        
                        <StackPanel.Triggers>
                            <EventTrigger RoutedEvent="Mouse.MouseEnter">
                                <BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard" Storyboard="{StaticResource OnMouseEnter1}" />
                            </EventTrigger>
                            <EventTrigger RoutedEvent="Mouse.MouseLeave">
                                <BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}" />
                            </EventTrigger>
                        </StackPanel.Triggers>
                    </StackPanel>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
            
        </TreeView>
    </DockPanel>
</UserControl>
